#pragma once
#include <iostream>
#include <string>

using namespace std;

class Question
{
private:
	string question;
	string right_answer;
	double point_right_answer;
	string student_answer;
	double point_student_answer;
public:

	Question(void)
	{
		question = "";
		right_answer = "";
		point_right_answer = -1;
		student_answer = "";
		point_student_answer = -1;
	}

	Question(string question, string right_answer, double point_right_answer, string student_answer, double point_student_answer)
		:question(question), right_answer(right_answer), point_right_answer(point_right_answer), student_answer(student_answer), point_student_answer(point_student_answer)
	{

	}


	void Check()
	{
		if (student_answer == right_answer)
			point_student_answer = point_right_answer;
		else
			point_student_answer = 0;

	}


	void Read()
	{
		cout << "Question = ";
		cin >> question;
		cout << "Right answer = ";
		cin >> right_answer;
		cout << "Points for right answer = ";
		cin >> point_right_answer;
		cout << "Students answer = ";
		cin >> student_answer;
		cout << "Points for student = ";
		cin >> point_student_answer;
	}


	void Write()
	{
		cout << "(" << question << "," << right_answer << "," << point_right_answer << "," << student_answer << "," << point_student_answer << ")" << endl;
	}

	friend ostream & operator <<(ostream & out, Question & question)
	{
		out << "(";
		out << question.question << ",";
		out << question.right_answer << ",";
		out << question.point_right_answer << ",";
		out << question.student_answer << ",";
		out << question.point_student_answer << ")";

		return out;
	}

	friend istream & operator >> (istream & in, Question& question)
	{
		cout << "Question = ";
		in >> question.question;
		cout << "Right answer = ";
		in >> question.right_answer;
		cout << "Points for right answer = ";
		in >> question.point_right_answer;
		cout << "Students answer = ";
		in >> question.student_answer;
		cout << "Points for student = ";
		in >> question.point_student_answer;

		return in;
	}



	~Question()
	{
	}

	//Getters
	string GetQuestion() { return question; }
	string GetRight_answer() { return right_answer; }
	double GetPoint_right_answer() { return point_right_answer; }
	string GetStudent_answer() { return student_answer; }
	double GetPoint_student_answer() { return point_student_answer; }

	//Setters
	void SetQuestion(string question) { this->question = question; }
	void SetRight_answer(string right_answer) { this->right_answer = right_answer; }
	void SetPoint_right_answer(double point_right_answer) { this->point_right_answer = point_right_answer; }
	void SetStudent_answer(string student_answer) { this->student_answer = student_answer; }
	void SetPoint_student_answer(double point_student_answer) { this->point_student_answer = point_student_answer; }
};

